package learn.spring.disruptor;

import com.lmax.disruptor.EventHandler;

import learn.spring.Timer;
import lombok.extern.slf4j.Slf4j;

/**
 * 消费者
 * 
 * @author PinWei Wan
 * @since 2.6.9
 */
@Slf4j
public class MessageConsumer implements EventHandler<MessageModel> {
    @Override
    public void onEvent(MessageModel event, long sequence, boolean endOfBatch) {
        log.info("接收到消息: {}", event.getMessage());
        // 模拟业务处理
        long cost = Timer.mock();

        log.info("处理消息结束: {}毫秒", cost);
    }
}
